/**********************************************************
 * SystemMaintenanceAction.java.java
 * Created by Ashutosh
 * Last modified Date: Sep 18, 2008 10:50:11 AM by Ashutosh
 * Revision: <svn revision #>
 * Version : 0.1
 * Copyright (c) 2008 - 2009 cyberThink Infotech Pvt. Ltd., All rights reserved.
 **********************************************************/

package com.printeverywhere.action;

import org.apache.log4j.Logger;

import com.printeverywhere.delegator.CommonFunctionDelegator;
import com.printeverywhere.dto.SystemMaintenance;

/**
 * The Class SystemMaintenanceAction.
 */
public class SystemMaintenanceAction  extends AdminSystemManagement {

	/** Logger for this class. */
	private static final Logger logger = Logger.getLogger(SystemMaintenanceAction.class);

	/** The Constant serialVersionUID. */
	private static final long serialVersionUID = 1L;

	private SystemMaintenance systemMaintenance;

	/* (non-Javadoc)
	 * @see com.opensymphony.xwork2.ActionSupport#execute()
	 */
	public String execute() throws Exception{
		if (logger.isDebugEnabled()) {
			logger.debug("execute() - start"); //$NON-NLS-1$
		}
		try {
			this.systemMaintenance = (SystemMaintenance) CommonFunctionDelegator.getAllfromtable(SystemMaintenance.class.getName()).get(0);
		} catch (Exception e) {
			return INPUT;
		}

		if (logger.isDebugEnabled()) {
			logger.debug("execute() - end"); //$NON-NLS-1$
		}
		return SUCCESS;
	}

	public String updateSystemMaintenance() throws Exception{
		if (logger.isDebugEnabled()) {
			logger.debug("execute() - start"); //$NON-NLS-1$
		}
		try {
			CommonFunctionDelegator.generalUpdatebyobj(this.systemMaintenance);
		} catch (Exception e) {
			return INPUT;
		}

		if (logger.isDebugEnabled()) {
			logger.debug("execute() - end"); //$NON-NLS-1$
		}
		return SUCCESS;
	}

	public SystemMaintenance getSystemMaintenance() {
		return systemMaintenance;
	}

	public void setSystemMaintenance(SystemMaintenance systemMaintenance) {
		this.systemMaintenance = systemMaintenance;
	}
}